//################################
// 版权所有：鸽子游戏俱乐部
// 系统名称：鸽子游戏俱乐部-移动版
// 文件名称：firstpageService.js
// 创建时间：2017年05月02日
// 创建人员：Lemo
// 功能说明：首页service
//################################
'use strict';

import Config from '../common/config';
import CommonFunc from '../common/commonFunc';
import { request } from '../utils/requestUtil';
import UIConstants from '../common/uiconstants';

function getGameList(type, page, pagenum){
    // alert(type+' - '+page);
    return new Promise((resolve, reject) => {
        if (type=='XBOX') {
            var result = {
                "pageResult":{"totalPageCount":3},
                "data":[
                    {
                        "id":"123456",
                        "name": "XGTA6",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "24",
                        "rents":"45"
                    },{
                        "id":"123456",
                        "name": "XNBA2K17",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "XFIFA2017",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "XPES2016",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "XNBA2K16",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "XNBA2K17",
                        "language":"简体中文",
                        "zone": "国行",
                        "storage": "30",
                        "rents":"86"
                    },{
                        "id":"123456",
                        "name": "XFIFA2017",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "XPES2016",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    }],
                "stringData": null,
                "message": null,
                "detail": null,
                "success": true,
                "status": "0000"
            };
        }
        else {
            var result = {
                "pageResult":{"totalPageCount":2},
                "data":[
                    {
                        "id":"123456",
                        "name": "GTA5",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "NBA2K17",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "FIFA2017",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "PES2016",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "NBA2K16",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "NBA2K17",
                        "language":"简体中文",
                        "zone": "国行",
                        "storage": "30",
                        "rents":"86"
                    },{
                        "id":"123456",
                        "name": "FIFA2017",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "PES2016",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "NBA2K16",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    },{
                        "id":"123456",
                        "name": "NBA2K17",
                        "language":"繁体中文",
                        "zone": "港版",
                        "storage": "48",
                        "rents":"90"
                    }],
                "stringData": null,
                "message": null,
                "detail": null,
                "success": true,
                "status": "0000"
            };
        }
        let r = {"success": result.success,"pageCount":result.pageResult.totalPageCount,"data":result.data,"detail":result.detail};
        resolve(r);
        /*
        var requestUrl = CommonFunc.getUrlConfig('getAllOrgs',UIConstants.contacts.id);

        let params = {};
        params.timeout = 3000;
        params.method = 'get';
        params.url = requestUrl.replace('{PARENTID}',parentId);
    
        request(params)
        .then((responseData) => {
            if (responseData.status) {
                var result = {
                    status: responseData.status,
                    data: responseData.data,
                };
                resolve(result);
            }
            else {
                var result = {
                    status: responseData.status,
                    message: responseData.message,
                };
                reject(result);
            }
        })
        .catch((error) => {
            reject(error);
        });*/
    });
}

module.exports = {
    getGameList,
}